import {BrowserRouter, Route, Switch, Redirect} from 'react-router-dom';
import Admin from "./views/admin";
import Login from "./views/login";

function App() {
  return (
    <BrowserRouter>
      <Switch>
        {/*有二级路由时，不要使用exact，否则无法匹配到*/}
        <Route path="/admin/login" component={Login}/>
        <Route path="/admin" component={Admin}/>
        {/*当匹配到/时，自动跳转到登录页*/}
        <Redirect from='/' to='/admin/login'/>
      </Switch>
    </BrowserRouter>
  );
}

export default App;
